<!--
 * @Author: 'yangyuhang1203' '2621131059@qq.com'
 * @Date: 2025-09-09 11:14:13
 * @LastEditors: 'yangyuhang1203' '2621131059@qq.com'
 * @LastEditTime: 2025-09-09 11:27:08
 * @FilePath: \企业级\前端\js\js函数-1.html
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>js函数</title>
</head>
<body>
    <script>
        //函数的声明（方法一）
        function add(a,b){
            return a+b;
        }
        //函数的声明（方法二）
        var fAdd = function(a,b){
            return a+b;
        }
        //函数调用
        let r1 = add(1,2);
        let r2 = add("1","2");
        //行为传入参数
        let r3 = add(1,fAdd);
        console.log(r1);
        console.log(r2);
        console.log(r3);
        console.log(typeof r3);
        console.log(typeof fAdd);
    </script>
</body>
</html>